<?php 
	class hd{
		public function run(){
			self::setConst();
			self::loadSysFile();
			self::createDir();
			application::run();
		}
		private static function setConst(){
			define("PATH_HD",dirname(__FILE__));
			define("PATH_ROOT",$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['SCRIPT_NAME']));
			define("PATH_APP",PATH_ROOT.'/'.APP_NAME);
		}
		private static function createDir(){
			$dirs = array(
				PATH_ROOT.'/temp',
				PATH_APP,
				PATH_APP.'/control',
				PATH_APP.'/template',
				PATH_ROOT.'/upload',
				PATH_APP.'/config'
			);
			foreach($dirs as $v){
				is_dir($v) || mkdir($v,0777,true);
			}
		}
		private function loadSysFile(){
			$files = array(
				PATH_HD.'/boot/functions.php'
			);
			foreach($files as $f){
				include $f;
			}
		}
	}
	hd::run();
?>